<template>
<div class="about">
    <el-row>
        <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-xuesheng3"></use>
        </svg>
        <el-button type="danger" @click="onCnlick"  class="iconfont icon-jichufuwu">危险按钮</el-button>
        <el-button type="danger" @click="onCnlick1" >危险按钮1</el-button>
    </el-row>

    {{ data.pxxxx}}
</div>
    <div>
        <el-form :inline="true" :model="data.ueser" class="demo-form-inline">
            <el-form-item label="Approved by">
                <el-input v-model="data.ueser.pass" placeholder="Approved by" clearable />
            </el-form-item>
            <el-form-item label="Approved by">
                <el-input v-model="data.ueser.username" placeholder="Approved by" clearable />
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="onSubmit">Query</el-button>
            </el-form-item>
        </el-form>
    </div>
</template>

<script setup>
    import {_getTest,_postTest} from '../../api'
    import {reactive} from 'vue'
    import {useRouter} from 'vue-router'
    const data=reactive({
        ueser:{
            pass:'',
            username:''
        },
        pxxxx:''
        }
    )
    const router=useRouter();
    const onCnlick =async () => {
        console.log('llllkl')
        const res = await _getTest()
        const res1 = await _postTest(data.ueser)
        console.log(res)
        console.log(res1)
    }
    const onCnlick1 =async () => {
        console.log('llllkl')
        const res1 = await _postTest(data.ueser)
        router.push({ path: '/websoket' })
        data.ueser=res1.data.data;
    }

    const onSubmit =async () => {
        const res1 = await _postTest(data.ueser)
        // router.push({ path: '/test' })

        console.log(res1)
        data.ueser=res1.data
        data.pxxxx=data.ueser.pass
    }


</script>
<style>
    .icon{
        width: 20px;
        height: 20px;
    }
</style>
